//package com.zmn.plat.dubbo.impl.product.businessline;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Objects;
//import java.util.stream.Collectors;
//
//import javax.annotation.Resource;
//import javax.validation.Valid;
//import javax.validation.constraints.NotNull;
//
//import com.zmn.common.dictionary.DictModel;
//import com.zmn.plat.common.dictionary.ProductDict;
//import com.zmn.plat.common.dto.product.businessline.ProductBusinessLineDIO;
//import com.zmn.plat.common.dto.product.businessline.ProductBusinessLineDRO;
//import com.zmn.plat.utils.bean.BeanCopyUtils;
//import org.apache.dubbo.config.annotation.Service;
//
//import com.zmn.common.dto.VtDTO;
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.common.utils.collection.CollectionUtil;
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import com.zmn.plat.common.dictionary.PlatErrorCodeDict;
//import com.zmn.plat.common.dto.product.businessline.ProductBusinessLineNameAndBizTypeDRO;
//import com.zmn.plat.common.exception.PlatException;
//import com.zmn.plat.dubbo.interfaces.product.businessline.ProductBusinessLineListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.product.businessline.ProductBusinessLine;
//import com.zmn.plat.model.entity.product.businessline.ProductBusinessLineQuery;
//import com.zmn.plat.services.interfaces.product.businessline.ProductBusinessLineService;
//
//import io.swagger.annotations.Api;
//import lombok.extern.slf4j.Slf4j;
//
///**
// * 产品业务线dubbo接口类
// *
// * @auther: tanbiao
// * @since: 2020/10/28 11:01
// */
//@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
//@Api(value = "产品业务线远程服务", tags = {"产品业务线"})
//@Slf4j
//public class ProductBusinessLineListRemoteServiceImpl implements ProductBusinessLineListRemoteService {
//
//    @Resource
//    ProductBusinessLineService productBusinessLineService;
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<VtDTO> getNameVtById(Integer groupId) {
//        log.info("getNameVtById：groupId={}", groupId);
//
//        ProductBusinessLine productBusinessLine = productBusinessLineService.findById(groupId);
//
//        if (Objects.isNull(productBusinessLine)) {
//            log.error("productBusinessLine not Exist.groupId:{},errorCode:{}", groupId, PlatErrorCodeDict.ERROR_CODE_PRODUCT_BIZLINE_NO_DATA);
//            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PRODUCT_BIZLINE_NO_DATA);
//        }
//
//        return ResponseDTO.success(new VtDTO(groupId, productBusinessLine.getName()));
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ProductBusinessLineNameAndBizTypeDRO>> listNameAndBizTypeVtByIdList(List<Integer> groupIdList) {
//
//        log.info("listNameAndBizTypeVtByIdList, bizType:{}，groupIdList:{}", groupIdList);
//
//        try {
//            List<ProductBusinessLine> productBusinessLineList = productBusinessLineService.listByIdList(groupIdList);
//            List<ProductBusinessLineNameAndBizTypeDRO> dtos = productBusinessLineList.stream()
//                .map(productBusinessLine -> new ProductBusinessLineNameAndBizTypeDRO(productBusinessLine.getRelateId(), productBusinessLine.getName(), productBusinessLine.getBizType())).distinct()
//                .collect(Collectors.toList());
//            return ResponseDTO.success(dtos);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        }
//    }
//
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listVtByNameListAndBizType(Integer bizType, List<String> nameList) {
//        log.info("listVtByNameListAndBizType：bizType:{}，nameList:{}", bizType, nameList);
//
//        try {
//            List<ProductBusinessLine> productBusinessLineList = productBusinessLineService.listByNameListAndBizType(bizType, nameList);
//            List<VtDTO> dtos = productBusinessLineList.stream().map(productBusinessLine -> new VtDTO(productBusinessLine.getRelateId(), productBusinessLine.getName(), productBusinessLine.getStatus()))
//                .distinct().collect(Collectors.toList());
//            return ResponseDTO.success(dtos);
//        } catch (PlatException e) {
//            return ResponseDTO.fromErrorCodeTable(e.getErrorCode());
//        }
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listVtByBizType(Integer bizType, Integer status) {
//        log.info("listVtByBizType：bizType={},status={}", bizType, status);
//
//        ProductBusinessLineQuery query = new ProductBusinessLineQuery();
//        query.setBizType(bizType);
//        query.setStatus(status);
//        List<ProductBusinessLine> productBusinessLineList = productBusinessLineService.listByQuery(query);
//
//        if (CollectionUtil.isNullOrEmpty(productBusinessLineList)) {
//            log.error("productBusinessLineList is empty.errorCode:{}", PlatErrorCodeDict.ERROR_CODE_PRODUCT_BIZTYPE_NO_BIZLINE_DATA);
//            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PRODUCT_BIZTYPE_NO_BIZLINE_DATA);
//        }
//
//        List<VtDTO> dtos =
//            productBusinessLineList.stream().map(productBusinessLine -> new VtDTO(productBusinessLine.getRelateId(), productBusinessLine.getName())).distinct().collect(Collectors.toList());
//
//        return ResponseDTO.success(dtos);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<VtDTO>> listVtByBizTypeList(List<Integer> bizTypeList, Integer status) {
//        log.info("listVtByBizType：bizTypeList={},status={}", bizTypeList, status);
//
//        ProductBusinessLineQuery query = new ProductBusinessLineQuery();
//        query.setBizTypeList(bizTypeList);
//        query.setStatus(status);
//        List<ProductBusinessLine> productBusinessLineList = productBusinessLineService.listByQuery(query);
//
//        if (CollectionUtil.isNullOrEmpty(productBusinessLineList)) {
//            log.error("productBusinessLineList is empty.errorCode:{}", PlatErrorCodeDict.ERROR_CODE_PRODUCT_BIZTYPE_NO_BIZLINE_DATA);
//            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PRODUCT_BIZTYPE_NO_BIZLINE_DATA);
//        }
//
//        List<VtDTO> dtos =
//            productBusinessLineList.stream().map(productBusinessLine -> new VtDTO(productBusinessLine.getRelateId(), productBusinessLine.getName())).distinct().collect(Collectors.toList());
//
//        return ResponseDTO.success(dtos);
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<ProductBusinessLineDRO>> queryList(@NotNull(message = "入参不能为空") @Valid ProductBusinessLineDIO productBusinessLineDIO) {
//        ProductBusinessLineQuery query = new ProductBusinessLineQuery();
//        query.setBizType(productBusinessLineDIO.getBizType());
//        query.setKeyWord(productBusinessLineDIO.getKeyword());
//        query.setIds(productBusinessLineDIO.getIds());
//        List<ProductBusinessLine> productBusinessLineList = productBusinessLineService.listByQuery(query);
//        if (CollectionUtil.isNullOrEmpty(productBusinessLineList)) {
//            return ResponseDTO.success(new ArrayList<>());
//        }
//        List<ProductBusinessLineDRO> productBusinessLineDROList = productBusinessLineList.stream()
//                .map(e -> {
//                    ProductBusinessLineDRO productBusinessLineDRO = new ProductBusinessLineDRO();
//                    BeanCopyUtils.copyProperties(e, productBusinessLineDRO);
//                    productBusinessLineDRO.setBizTypeName(ProductDict.getBizTypeCNENName(e.getBizType()));
//                    return productBusinessLineDRO;
//                }).collect(Collectors.toList());
//        return ResponseDTO.success(productBusinessLineDROList);
//    }
//
//    @Override
//    public ResponseDTO<List<DictModel>> listBizType() {
//        return ResponseDTO.success(ProductDict.listBizType());
//    }
//
//
//}
